package com.iusis.game;

import android.app.*;
import android.graphics.*;
import android.opengl.*;
import android.os.*;
import android.view.*;
import android.view.View.OnClickListener;
import android.widget.*;

public class MainActivity extends Activity implements OnClickListener {
	GLSurfaceView glSurfaceView;
	Button btnL, btnR;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main1);

		// glsurfaceview 객체를 가져옴
		glSurfaceView = (GLSurfaceView) findViewById(R.id.glsurfaceview);
		
		
		// 서피스뷰를 투명하게 설정
		glSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);		
		glSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
		
		glSurfaceView.setRenderer(new MeteoRenderer(true));

		
		btnL = (Button) findViewById(R.id.button1);
		btnL.setOnClickListener(this);
		btnR = (Button) findViewById(R.id.button2);
		btnR.setOnClickListener(this);
	}

	@Override
	protected void onResume() {
		super.onResume();
		glSurfaceView.onResume();
	}

	@Override
	protected void onPause() {
		super.onPause();
		glSurfaceView.onPause();
	}

	// 클릭 리스너
	@Override
	public void onClick(View v) {
		Toast toast;
		CharSequence tmp="";
		switch (v.getId()) {
		case R.id.button1: // L버튼
			tmp = "L";
			break;
		case R.id.button2: // R버튼
			tmp = "R";
			break;
		}
		toast = Toast.makeText(this, tmp+"버튼이 눌렸음", Toast.LENGTH_SHORT);
		toast.show();
	}
}
